Skip to content

design-proposals: tenant module overrides#4

Open
myasnikovdaniil wants to merge 3 commits intomainfrom
proposal/tenant-module-overrides
Open

design-proposals: tenant module overrides#4
myasnikovdaniil wants to merge 3 commits intomainfrom
proposal/tenant-module-overrides

Conversation

@myasnikovdaniil
Copy link
Copy Markdown

@myasnikovdaniil myasnikovdaniil commented Apr 17, 2026

Summary

Proposes a design for per-tenant overrides of bundled Tenant modules
(etcd/monitoring/ingress/seaweedfs). Currently each module is a boolean
flag and its values come only from the cluster-wide cozystack-values
Secret, leaving admins with no override path short of disabling the
module and hand-rolling a HelmRelease (which drops tenant scaffolding,
ApplicationDefinition wiring, labels, and quotas).

The proposal pilots the mechanism on etcd:

  • Typed module schema. etcd: bool becomes etcd: { enabled, valuesOverride }.
  • New @embed directive in cozyvalues-gen. Pulls the etcd chart's
    values.yaml annotations into the tenant chart's schema at build
    time. Schema truth stays in one place; no hand-duplicated types.
  • Rendered overrides Secret appended to the HelmRelease's
    valuesFrom → tenant deep-merges on top of cluster defaults.
  • Platform migration rewrites existing bool-form manifests to
    object-form; the Helm template also keeps a bool-form compatibility
    shim for two releases. Zero breakage for existing Tenant manifests.
  • Monitoring, ingress, seaweedfs ride the same primitive in a
    follow-up release with no new design work.

Scope is deliberately narrow: multi-etcd-per-tenant and the broader
admin customization/overlay story are called out as sibling proposals.

Test plan

  • Review the proposal for technical soundness and scope boundaries
  • Confirm @embed directive fits the cozyvalues-gen roadmap
  • Confirm migration ordering vs other planned platform migrations
  • DCO check passes (commit is signed off)

Summary by CodeRabbit

  • Documentation
    • Added a draft design proposal for per-tenant module overrides: new tenant config object form, migration and deprecation plan, dashboard form behavior changes, precedence rules ensuring tenant overrides trump cluster values, rollout/rollback considerations, testing checklist, security constraints, and open questions about embed/override handling.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 17, 2026

Warning

Rate limit exceeded

@myasnikovdaniil has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 29 minutes and 30 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 29 minutes and 30 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cdeff2aa-6722-4126-8774-0eb34dc4e9e2

📥 Commits

Reviewing files that changed from the base of the PR and between 8aae9cd and 5bfc12a.

📒 Files selected for processing (1)
  • design-proposals/tenant-module-overrides/README.md
📝 Walkthrough

Walkthrough

Adds a design proposal for per-tenant module overrides: typed Tenant values with object-form module entries, a @embed directive for cozyvalues-gen to source typed override schemas at build time, Helm template handling to render per-module override Secrets, and a platform migration plan with precedence and rollback notes.

Changes

Cohort / File(s) Summary
Tenant Module Overrides Design Proposal
design-proposals/tenant-module-overrides/README.md
Adds a new draft design proposal describing: typed per-tenant module override structure (object with enabled + valuesOverride), @embed <package> as <TypedefName> directive semantics for cozyvalues-gen (recursive typedef resolution, namespacing, default preservation, failure modes), Helm template normalization of legacy boolean flags, generation and ordering of per-module override Secrets appended to HelmRelease valuesFrom (after cozystack-values), platform migration steps to rewrite boolean fields idempotently, testing/security considerations, and open questions/alternatives.

Sequence Diagram(s)

sequenceDiagram
  participant Dev as Developer / cozyvalues-gen
  participant CI as Build/CI
  participant Helm as Helm templates
  participant K8s as Kubernetes (Secrets, HelmRelease)
  participant Cluster as Cluster controllers

  Dev->>CI: commit chart with `@embed <package> as Alias` annotations
  CI->>Dev: run cozyvalues-gen -> generate typedefs & schema
  CI->>Helm: package charts with embedded override schemas
  Helm->>K8s: render tenant HelmRelease with module object normalization
  Helm->>K8s: create per-module override Secret when `enabled: true`
  K8s->>Cluster: attach Secret to HelmRelease.valuesFrom (after `cozystack-values`)
  Cluster->>K8s: reconcile HelmRelease, apply tenant module values
Loading

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 I nibble on schemas, tidy and neat,
I stash overrides like carrots to eat,
Modules now listen when tenants request,
Secrets tucked snug, precedence blessed,
A hop, a patch — the garden is sweet! 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: introducing a design proposal for tenant module overrides. It is specific, directly related to the changeset, and guides readers to the primary feature being proposed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch proposal/tenant-module-overrides

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This design proposal introduces per-tenant overrides for bundled modules such as etcd and seaweedfs by transitioning the module configuration from a boolean to an object structure. It includes a new @embed directive for the cozyvalues-gen tool to automate schema generation and updates Helm templates to merge tenant-specific values via Flux's valuesFrom mechanism. The review feedback correctly identifies a documentation inconsistency regarding the JSON schema path for valuesOverride and points out necessary syntax corrections for invoking the dict function within the Go template examples to ensure they function as intended.


Generator output side effects:

- Tenant chart's `values.schema.json` gains the full etcd sub-schema under `properties.etcd.properties.values`.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The JSON schema path mentioned here (properties.etcd.properties.values) does not match the field name valuesOverride defined in the design (lines 71, 76, 82). It should be updated for consistency.

Suggested change
- Tenant chart's `values.schema.json` gains the full etcd sub-schema under `properties.etcd.properties.values`.
- Tenant chart's values.schema.json gains the full etcd sub-schema under properties.etcd.properties.valuesOverride.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — renamed to properties.etcd.properties.valuesOverride to match the field name used in Design §1 and the rest of the proposal. Commit: 8aae9cd.

{{- $etcd := .Values.etcd }}
{{- if kindIs "bool" $etcd }}
{{- /* Bool-form compatibility shim. Normalized to object-form. */ -}}
{{- $etcd = dict "enabled" $etcd "valuesOverride" dict }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

In Helm/Sprig templates, dict is a function. To assign an empty dictionary as a value, you must invoke it using parentheses: (dict). Without parentheses, you are passing the function reference itself as the value for the valuesOverride key.

Suggested change
{{- $etcd = dict "enabled" $etcd "valuesOverride" dict }}
{{- $etcd = dict "enabled" $etcd "valuesOverride" (dict) }}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — switched to (dict). Go templates do resolve dict as a zero-arg call in argument position, so this was a cosmetic fix, but the parens make the intent unambiguous and match the idiom used across the Cozystack Helm charts. Commit: 8aae9cd.

type: Opaque
stringData:
values.yaml: |
{{ toYaml (default dict $etcd.valuesOverride) | indent 4 }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The dict function should be invoked as (dict) when used as an argument to the default function. This ensures that an empty map is provided as the default value if valuesOverride is empty or nil.

Suggested change
{{ toYaml (default dict $etcd.valuesOverride) | indent 4 }}
{{ toYaml (default (dict) $etcd.valuesOverride) | indent 4 }}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — same treatment as the shim a few lines above: default (dict) $etcd.valuesOverride. Commit: 8aae9cd.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@design-proposals/tenant-module-overrides/README.md`:
- Around line 109-110: The docs/spec mix two field names for the same concept
(etcd.valuesOverride vs etcd.values) causing schema and README drift; pick and
use one name consistently across the proposal and generated artifacts. Update
the proposal text, the example lines that mention `values` (e.g., the sentence
about Tenant chart's `values.schema.json` and the generated README reference
lines around 109 and 211) to use the canonical `valuesOverride` identifier, and
verify any schema property paths (`properties.etcd.properties.values`) are
renamed to `properties.etcd.properties.valuesOverride` so the generated README
and schema match.
- Around line 180-185: The documentation and migration scope are inconsistent:
either restrict the migration to only rewrite etcd boolean values or explicitly
state that Release N templates already normalize bool/object-form for
monitoring, ingress, and seaweedfs before this migration runs. Update the README
so the migration description and the “Release N” rollout notes match: if keeping
the multi-module rewrite (etcd, monitoring, ingress, seaweedfs) ensure you add a
note that the cozystack-tenant chart templates normalize bool/object-form for
monitoring/ingress/seaweedfs prior to migration; otherwise change the migration
steps to only list/modify HelmRelease spec.values.etcd and leave
monitoring/ingress/seaweedfs untouched until their templates/schema are safe to
accept object-form. Ensure references to HelmRelease, cozystack-tenant, etcd,
monitoring, ingress, seaweedfs, and “Release N” are updated consistently.
- Around line 90-92: The fenced code block containing "@embed <package-path> as
<TypedefName>" is missing a fence language and triggers MD040; update that block
(the triple-backtick block that wraps "@embed <package-path> as <TypedefName>")
to include a language like "text" so it becomes "```text" at the opening fence,
preserving the content and closing fence unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6ab29c9e-0587-4034-b66a-e0e88f476bed

📥 Commits

Reviewing files that changed from the base of the PR and between 33dad69 and 68f63a9.

📒 Files selected for processing (1)
  • design-proposals/tenant-module-overrides/README.md

Comment thread design-proposals/tenant-module-overrides/README.md Outdated
Comment thread design-proposals/tenant-module-overrides/README.md Outdated
Comment thread design-proposals/tenant-module-overrides/README.md
Proposes replacing the Tenant chart's boolean module flags
(etcd/monitoring/ingress/seaweedfs) with typed override objects,
sourced through a new @embed directive in cozyvalues-gen. Piloted on
etcd; monitoring/ingress/seaweedfs follow the same primitive in later
PRs.

Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
@myasnikovdaniil myasnikovdaniil force-pushed the proposal/tenant-module-overrides branch from 68f63a9 to 0319581 Compare April 17, 2026 09:18
- Fix schema path in Design §2 to match the valuesOverride field name.
- Invoke dict() explicitly as (dict) in the Helm template schematics
  for clarity.
- Add a fence language to the @embed syntax block.

Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants